%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for mutations/v4/pgJwtTypeIdentifier-withPayload"
    Bucket0("Bucket 0 (root)"):::bucket
    Bucket1("Bucket 1 (mutationField)<br />Deps: 14, 15, 20, 2<br /><br />1: PgSelect[11]<br />2: PgSelectRows[17]<br />ᐳ: 16, 18, 19"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 18, 11, 2, 19<br /><br />ROOT Object{1}ᐸ{result}ᐳ[19]<br />1: <br />ᐳ: 21, 23, 24, 25<br />2: PgSelect[22]<br />3: PgSelectRows[27]<br />ᐳ: First[26], PgSelectSingle[28]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 18, 11, 25, 28, 21<br /><br />ROOT PgSelectSingle{1}ᐸauthenticate_payloadᐳ[18]<br />1: <br />ᐳ: 29, 40<br />2: PgSelect[30]<br />3: PgSelectRows[35]<br />ᐳ: 34, 36, 46"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 28, 11<br /><br />ROOT PgSelectSingle{2}ᐸpersonᐳ[28]"):::bucket
    Bucket5("Bucket 5 (nullableBoundary)<br />Deps: 28, 11<br /><br />ROOT PgSelectSingle{2}ᐸpersonᐳ[28]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3 & Bucket4
    Bucket3 --> Bucket5

    %% plan dependencies
    __InputObject6{{"__InputObject[6∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[7]<br />- Constantᐸ1ᐳ[49]<br />- Constantᐸ'2'ᐳ[50]<br />- Constantᐸ'3'ᐳ[51]"}}:::plan
    PgFromExpression15{{"PgFromExpression[15∈0] ➊<br />More deps:<br />- Constantᐸ1ᐳ[49]<br />- Constantᐸ'2'ᐳ[50]<br />- Constantᐸ'3'ᐳ[51]"}}:::plan
    Object14{{"Object[14∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access12{{"Access[12∈0] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access13{{"Access[13∈0] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access12 & Access13 --> Object14
    ApplyInput20{{"ApplyInput[20∈0] ➊"}}:::plan
    __InputObject6 --> ApplyInput20
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ<br />Dependents: 4"]:::plan
    PgSelect11[["PgSelect[11∈1] ➊<br />ᐸauthenticate_payload(mutation)ᐳ"]]:::sideeffectplan
    Object14 & PgFromExpression15 & ApplyInput20 --> PgSelect11
    First16{{"First[16∈1] ➊"}}:::plan
    PgSelectRows17[["PgSelectRows[17∈1] ➊"]]:::plan
    PgSelectRows17 --> First16
    PgSelect11 --> PgSelectRows17
    PgSelectSingle18{{"PgSelectSingle[18∈1] ➊<br />ᐸauthenticate_payloadᐳ"}}:::plan
    First16 --> PgSelectSingle18
    Object19{{"Object[19∈1] ➊<br />ᐸ{result}ᐳ"}}:::plan
    PgSelectSingle18 --> Object19
    PgSelect22[["PgSelect[22∈2] ➊<br />ᐸpersonᐳ"]]:::plan
    Object25{{"Object[25∈2] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgClassExpression21{{"PgClassExpression[21∈2] ➊<br />ᐸ__authenti...oad__.”id”ᐳ"}}:::plan
    Object25 & PgClassExpression21 --> PgSelect22
    Access23{{"Access[23∈2] ➊<br />ᐸ2.pgSettingsᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access24{{"Access[24∈2] ➊<br />ᐸ2.withPgClientᐳ<br />More deps:<br />- __Value[2]"}}:::plan
    Access23 & Access24 --> Object25
    PgSelectSingle18 --> PgClassExpression21
    First26{{"First[26∈2] ➊"}}:::plan
    PgSelectRows27[["PgSelectRows[27∈2] ➊"]]:::plan
    PgSelectRows27 --> First26
    PgSelect22 --> PgSelectRows27
    PgSelectSingle28{{"PgSelectSingle[28∈2] ➊<br />ᐸpersonᐳ"}}:::plan
    First26 --> PgSelectSingle28
    PgSelect30[["PgSelect[30∈3] ➊<br />ᐸfrmcdc_jwtTokenᐳ"]]:::plan
    PgClassExpression29{{"PgClassExpression[29∈3] ➊<br />ᐸ__authenti...ad__.”jwt”ᐳ"}}:::plan
    Object25 & PgClassExpression29 --> PgSelect30
    PgSelectSingle18 --> PgClassExpression29
    First34{{"First[34∈3] ➊"}}:::plan
    PgSelectRows35[["PgSelectRows[35∈3] ➊"]]:::plan
    PgSelectRows35 --> First34
    PgSelect30 --> PgSelectRows35
    PgSelectSingle36{{"PgSelectSingle[36∈3] ➊<br />ᐸfrmcdc_jwtTokenᐳ"}}:::plan
    First34 --> PgSelectSingle36
    PgClassExpression40{{"PgClassExpression[40∈3] ➊<br />ᐸ__authenti...__.”admin”ᐳ"}}:::plan
    Object19 o--o PgClassExpression40
    PgClassExpression46{{"PgClassExpression[46∈3] ➊<br />ᐸ__frmcdc_jwt_token__ᐳ"}}:::plan
    PgSelectSingle36 --> PgClassExpression46
    PgClassExpression37{{"PgClassExpression[37∈4] ➊<br />ᐸ__person__.”id”ᐳ"}}:::plan
    PgSelectSingle28 --> PgClassExpression37
    PgClassExpression39{{"PgClassExpression[39∈4] ➊<br />ᐸ__person__...full_name”ᐳ"}}:::plan
    PgClassExpression37 o--o PgClassExpression39
    PgClassExpression47{{"PgClassExpression[47∈5] ➊<br />ᐸ__person__.”id”ᐳ"}}:::plan
    PgClassExpression39 o--o PgClassExpression47
    PgClassExpression48{{"PgClassExpression[48∈5] ➊<br />ᐸ__person__...full_name”ᐳ"}}:::plan
    PgClassExpression47 o--o PgClassExpression48

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,__InputObject6,Access12,Access13,Object14,PgFromExpression15,ApplyInput20 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgSelect11,First16,PgSelectRows17,PgSelectSingle18,Object19 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression21,PgSelect22,Access23,Access24,Object25,First26,PgSelectRows27,PgSelectSingle28 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression29,PgSelect30,First34,PgSelectRows35,PgSelectSingle36,PgClassExpression40,PgClassExpression46 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression37,PgClassExpression39 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5,PgClassExpression47,PgClassExpression48 bucket5

    %% implicit side effects
    PgSelect11 -.-o Access23
    PgSelect11 -.-o Access24

